home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6205 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  39 lines

  1. Path: ix.netcom.com!netnews
  2. From: Manuel Hernandez <ManuelHe@ix.netcom.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: The Ampersand suffix
  5. Date: 10 Feb 1996 20:54:50 GMT
  6. Organization: Netcom
  7. Message-ID: <4fj0mq$q4b@reader2.ix.netcom.com>
  8. NNTP-Posting-Host: irv-ca7-19.ix.netcom.com
  9. X-NETCOM-Date: Sat Feb 10 12:54:50 PM PST 1996
  10.  
  11. Is there such a thing as an ampersand suffix operator. I have seen them
  12. referred to in texts, though I think that they were actually
  13. address of  operators placed directly after a type declaration and one space
  14. away from the variable. Here is the example sort of saw. actually I made it up
  15. just to refer to the use of the &. I dont know if this would 
  16. work, and I dont want to include 100 lines of code on the actual 
  17. program I saw.
  18.  
  19. struct People
  20.   {
  21.     char name[20];
  22.     int  age;
  23.   };
  24.  
  25. void makeFriends( People& friend)
  26.   {
  27.     cout << "Who will you ask to dinner?" << endl;
  28.     cin.getline(friend.name,20)
  29.     cout << "How old is this person?" << endl;
  30.     cin >> friend.age
  31.   }
  32.  
  33. void main()
  34.   {
  35.     People friends
  36.     cout << "Lets have a party" << endl;
  37.     makeFriends(friends)
  38.    
  39.